#include <2025Linux.h>
#include "include/l8w8jwt/encode.h"
int main(int argc, char *argv[])
{
    char* jwt;
    size_t jwt_length;
    struct l8w8jwt_encoding_params params;
    l8w8jwt_encoding_params_init(&params);//配置加密的参数，并初始化
    params.alg = L8W8JWT_ALG_HS512;
    // 这三个参数永远不变
    params.sub = "Netdisk";//主题
    params.iss = "Niqiu";//发布者
    params.aud = "Daoyou";//观众
    params.iat = 0;
    params.exp = 0x7fffffff;//永久生效
    params.secret_key = (unsigned char*)argv[1];//这个参数是随着情况变化而变化
    params.secret_key_length = strlen((char *)params.secret_key);
    params.out = &jwt;
    params.out_length = &jwt_length;
    int r = l8w8jwt_encode(&params);//根据参数生成token
    printf("\n l8w8jwt example HS512 token: %s \n", r == L8W8JWT_SUCCESS ? jwt : " (encoding failure) ");
    /* Always free the output jwt string! */
    l8w8jwt_free(jwt);
    return 0;
}
